home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk1.zip / LST9-16.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  1KB  |  42 lines

  1. ;
  2. ; *** Listing 9-16 ***
  3. ;
  4. ; An illustration of the use of SUB AH,AH outside the
  5. ; processing loop to convert an array of byte values
  6. ; between 0 and 7Fh to an array of words. AH never changes
  7. ; from one pass through the loop to the next, so there's no
  8. ; need to continually set AH to 0.
  9. ;
  10.     jmp    Skip
  11. ;
  12. ARRAY_LENGTH    equ    1000
  13. ;
  14. Array1    label    byte
  15. ARRAY_VALUE=0
  16.     rept    ARRAY_LENGTH
  17.     db    ARRAY_VALUE
  18. ARRAY_VALUE=(ARRAY_VALUE+1) and 07fh
  19.                 ;cycle source array byte
  20.                 ; values from 0-7Fh
  21.     endm
  22. ;
  23. Array2    dw    ARRAY_LENGTH dup (?)
  24. ;
  25. Skip:
  26.     mov    si,offset Array1 ;set up array pointers
  27.     mov    di,offset Array2
  28.     mov    ax,ds
  29.     mov    es,ax        ;copy to & from same segment
  30.     cld            ;make string instructions
  31.                 ; increment pointers
  32.     mov    cx,ARRAY_LENGTH
  33.     sub    ah,ah        ;set up to make each byte
  34.                 ; read into AL a word in AX
  35.                 ; automatically
  36.     call    ZTimerOn
  37. ProcessingLoop:
  38.     lodsb            ;get the next element
  39.     stosw            ;save the word value
  40.     loop    ProcessingLoop    ;do the next element
  41.     call    ZTimerOff
  42.